"""给密码加密"""
import hashlib
from django.conf import settings
import uuid


def md5(data_string):
    obj = hashlib.md5(settings.SECRET_KEY.encode('utf-8'))
    obj.update(data_string.encode('utf-8'))
    return obj.hexdigest()


# 随机文件名
def uid(string):
    data = '{}-{}'.format(uuid.uuid4(), string)
    return md5(data)
